#!/usr/bin/env php
<?php
// +----------------------------------------------------------------------
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2006-2016 http://thinkphp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: yunwuxin <448901948@qq.com>
// +----------------------------------------------------------------------

date_default_timezone_set("Etc/GMT");

// 定义项目路径// 定义应用目录
define('APP_PATH', __DIR__ . '/application/');

define('RUNTIME_PATH',__DIR__ . '/runtime/cli/');

// 开始运行时间和内存使用
define('START_TIME', microtime(true));
define('START_MEM', memory_get_usage());
//环境变量
define('IS_CGI',(0 === strpos(PHP_SAPI,'cgi') || false !== strpos(PHP_SAPI,'fcgi')) ? 1 : 0 );
define('IS_CLI_', PHP_SAPI == 'cli' ? true : false);
define('REQUEST_METHOD', IS_CLI_ ? 'GET' : $_SERVER['REQUEST_METHOD']);

// 当前文件名
if(!defined('_PHP_FILE_')) {
     $_temp  = explode('.php',$_SERVER['PHP_SELF']);
     if(IS_CLI_){
         define('_PHP_FILE_',    rtrim(str_replace($_SERVER['SCRIPT_NAME'],'',$_temp[0].'.php'),'/'));
     }else{
        define('_PHP_FILE_',    rtrim(str_replace($_SERVER['HTTP_HOST'],'',$_temp[0].'.php'),'/'));
     }
}

if(!defined('__ROOT__')) {
 $_root  =   rtrim(dirname(_PHP_FILE_),'/');
 define('__ROOT__',  (($_root=='/' || $_root=='\\')?'':$_root));
}
define('NOW_TIME', $_SERVER['REQUEST_TIME']);
// 设置为当前脚本目录
chdir(dirname(__FILE__));
// 加载框架引导文件
require __DIR__ . '/vendor/topthink/framework/console.php';